www.gusucode.com > 忠网网站广告管理系统 ZonGG V1.3 > 忠网网站广告管理系统 ZonGG V1.3\code\Ad.asp

    <!-- #include file="include/Config.asp" -->
<!-- #include file="include/Conn.asp" -->
<!-- #include file="include/Function.asp" -->
<%
	'///******************************************************************
	'  应用时调用广告位 文件名:Ad.asp  参数:id 为 广告位 id 
	'  调用方法:<SCRIPT LANGUAGE=JavaScript src=Ad.asp?i=广告位id></SCRIPT>
	'******************************************************************/// 
	
	id=trim(request.querystring("i"))
	
	IF isnumeric(id) then

		if xmltype=1 then ''  xml 存取
		
		    strSourceFile = Server.MapPath(dataxml&"/Place/"&id&".xml")
		 
		    Set objXML =Server.CreateObject("Microsoft.XMLDOM")  '创建一个XML对像
		   
		    objXML.load(strSourceFile)  '把XML文件读入内存     
		
			Set xml=objXML.documentElement.selectSingleNode("Place")  '选取节点 Advertisement
			
			
				Pid=xml.childNodes.item(0).text
				Pname=xml.childNodes.item(1).text
				Plei=xml.childNodes.item(2).text
				Pcss=xml.childNodes.item(3).text
				Cid=xml.childNodes.item(4).text
				ADids=xml.childNodes.item(5).text
				
				ADids1=GgtiaoXsAct2(ADids)
				ADids =GgtiaoXsAct1(ADids)
				
		
			 
			 Select Case Plei
			 
			 	Case "1"	 	
			 	
			 	if Len(Pcss)>2 then
				if PubFgdy(Pcss,",",Ubound(split(Pcss,","))-6)="absolute" then				
				styles=" style=\""Z-INDEX: "&Pid&"; POSITION: absolute; border:0px;\""  "
				else		
				styles=" style=\""Z-INDEX: "&Pid&"; border:0px;\""  "
				end if		
				end if
			 	
				if  trim(ADids)<>"" and instr(trim(ADids),",")=0   then
				Aid=cint(trim(ADids))	
				Call xs_1()
				else
				if isnumeric(PubFgdy(ADids,",",0))=true then
				Aid=Cint(PubFgdy(ADids,",",0))		
				Call xs_1()		
				
				ADids=mid(ADids,len(Aid)+2)&","&Aid
				
				if ADids1<>"" then ADids=ADids&","&ADids1	
				
				call PubEditXml(dataxml&"/place/"&Pid&".xml","Place","5",ADids)	
				
				conn.execute "update from Place set ADids='"&ADids&"' where Pid="&Pid	' 入库		
					
				end if	
				end if	
			 		 	
			 	Case "2","3","4","5"
			 	
			 	if Len(Pcss)>2 then
				gao=PubFgdy(Pcss,",",2)
				kuan=PubFgdy(Pcss,",",3)		
				if gao="" then gao="100%"
				if kuan="" then kuan="100%"		
				if PubFgdy(Pcss,",",Ubound(split(Pcss,","))-6)="absolute" then				
				styles=" style=\""Z-INDEX: "&Pid&"; POSITION: absolute; "&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-3)&":"&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-2)&"; "&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-5)&":"&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-4)&"; height: "&gao&"; width: "&kuan&";  border: "&PubFgdy(Pcss,",",0)&"px solid "&PubFgdy(Pcss,",",1)&";\""  "
				else		
				styles=" style=\""Z-INDEX: "&Pid&"; height: "&gao&"; width: "&kuan&"; border: "&PubFgdy(Pcss,",",0)&"px solid "&PubFgdy(Pcss,",",1)&";\""  "
				end if		
				end if
		 	
				response.write "document.write('<DIV id=\""ZonGGLayer_P_"&Pid&"\"" "&styles&"><iframe marginwidth=0 marginheight=0 width=\"""&kuan&"\""  height=\"""&gao&"\"" frameborder=0  scrolling=no  name=\""忠网广告系统--http://gg.zon.cn\"" src=\"""&DqUrl&"/GGplaceXs_"&Plei&".asp?id="&Pid&"&Pname="&Pname&"&Plei="&Plei&"&Pcss="&Replace(Pcss,"#","#")&"&Cid="&Cid&"&ADids1="&ADids1&"&ADids="&ADids&"\""></iframe></DIV>');"
				
				Case "6" '' 依次循环弹出
				
				ADidss=split(ADids,",")
						
				
					if  trim(ADids)<>"" and instr(trim(ADids),",")=0   then
					Aid=cint(trim(ADids))	
					response.write "window.open('"&DqUrl&"/GGtiaoXs.asp?id="&Aid&"','忠网广告"&Aid&"','"&GgtiaoWH(Aid)&",top="&(i*5)&",left="&(i*5)&"');"
			
					else			
					
					if isnumeric(PubFgdy(ADids,",",0))=true then			
					
					 If isnumeric(PubFgdy(Pcss,",",0))=true then
					 Dim Aids:Aids=""
					 Dim wins
					 	
					 if Ubound(ADidss)+1 > Cint(PubFgdy(Pcss,",",0)) then
					 wins=Cint(PubFgdy(Pcss,",",0))
					 else
					 wins=Ubound(ADidss)+1
					 end if
						
						for i=0 to wins-1  '' 循环排列显示开始
						
							Aid=Cint(ADidss(i))		
							
							if Aids="" then
							Aids=Aid
							else
							Aids=Aids&","&Aid
							end if			
							
							response.write "window.open('"&DqUrl&"/GGtiaoXs.asp?id="&Aid&"','忠网广告"&Aid&"','"&GgtiaoWH(Aid)&",top="&(i*5)&",left="&(i*5)&"');"
							
						next
														
												
							if mid(ADids,len(Aids)+2)<>"" then
							ADids=mid(ADids,len(Aids)+2)&","&Aids
							else
							ADids=Aids
							end if
		
							if ADids1<>"" then ADids=ADids&","&ADids1						
							
							call PubEditXml(dataxml&"/place/"&Pid&".xml","Place","5",ADids)	
							
							conn.execute "update from Place set ADids='"&ADids&"' where Pid="&Pid	' 入库		
											
						
					 End if
						
					
					end if
					
					end if
		
				
			 End Select
		
			Set xml=nothing
			Set objXML =nothing	
		
		else '''''' 从数据库取数据
		
			Rs.open "select * from Place where Pid="&id,conn,1,1
			if not Rs.eof then			
			
				Pid=Rs(0)
				Pname=Rs(1)
				Plei=Rs(2)
				Pcss=Rs(3)
				Cid=Rs(4)
				ADids=Rs(5)
				
				ADids1=GgtiaoXsAct2(ADids)
				ADids =GgtiaoXsAct1(ADids)
				
		
			 
			 Select Case Plei
			 
			 	Case "1"	 	
			 	
			 	if Len(Pcss)>2 then
				if PubFgdy(Pcss,",",Ubound(split(Pcss,","))-6)="absolute" then				
				styles=" style=\""Z-INDEX: "&Pid&"; POSITION: absolute; border:0px;\""  "
				else		
				styles=" style=\""Z-INDEX: "&Pid&"; border:0px;\""  "
				end if		
				end if
			 	
				if  trim(ADids)<>"" and instr(trim(ADids),",")=0   then
				Aid=cint(trim(ADids))	
				Call xs_2()
				else
				if isnumeric(PubFgdy(ADids,",",0))=true then
				Aid=Cint(PubFgdy(ADids,",",0))		
				Call xs_2()		
				
				ADids=mid(ADids,len(Aid)+2)&","&Aid
				
				if ADids1<>"" then ADids=ADids&","&ADids1	

				conn.execute "update from Place set ADids='"&ADids&"' where Pid="&Pid	' 入库		
					
				end if	
				end if	
			 		 	
			 	Case "2","3","4","5"
			 	
			 	if Len(Pcss)>2 then
				gao=PubFgdy(Pcss,",",2)
				kuan=PubFgdy(Pcss,",",3)		
				if gao="" then gao="100%"
				if kuan="" then kuan="100%"		
				if PubFgdy(Pcss,",",Ubound(split(Pcss,","))-6)="absolute" then				
				styles=" style=\""Z-INDEX: "&Pid&"; POSITION: absolute; "&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-3)&":"&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-2)&"; "&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-5)&":"&PubFgdy(Pcss,",",Ubound(split(Pcss,","))-4)&"; height: "&gao&"; width: "&kuan&";  border: "&PubFgdy(Pcss,",",0)&"px solid "&PubFgdy(Pcss,",",1)&";\""  "
				else		
				styles=" style=\""Z-INDEX: "&Pid&"; height: "&gao&"; width: "&kuan&"; border: "&PubFgdy(Pcss,",",0)&"px solid "&PubFgdy(Pcss,",",1)&";\""  "
				end if		
				end if
		 	
				response.write "document.write('<DIV id=\""ZonGGLayer_P_"&Pid&"\"" "&styles&"><iframe marginwidth=0 marginheight=0 width=\"""&kuan&"\""  height=\"""&gao&"\"" frameborder=0  scrolling=no  name=\""忠网广告系统--http://gg.zon.cn\"" src=\"""&DqUrl&"/GGplaceXs_"&Plei&".asp?id="&Pid&"&Pname="&Pname&"&Plei="&Plei&"&Pcss="&Replace(Pcss,"#","#")&"&Cid="&Cid&"&ADids1="&ADids1&"&ADids="&ADids&"\""></iframe></DIV>');"
				
				Case "6" '' 依次循环弹出
				
				ADidss=split(ADids,",")
						
				
					if  trim(ADids)<>"" and instr(trim(ADids),",")=0   then
					Aid=cint(trim(ADids))	
					response.write "window.open('"&DqUrl&"/GGtiaoXs.asp?id="&Aid&"','忠网广告"&Aid&"','"&GgtiaoWH(Aid)&",top="&(i*5)&",left="&(i*5)&"');"
			
					else			
					
					if isnumeric(PubFgdy(ADids,",",0))=true then			
					
					 If isnumeric(PubFgdy(Pcss,",",0))=true then
 
					 if Ubound(ADidss)+1 > Cint(PubFgdy(Pcss,",",0)) then
					 wins=Cint(PubFgdy(Pcss,",",0))
					 else
					 wins=Ubound(ADidss)+1
					 end if
						
						for i=0 to wins-1  '' 循环排列显示开始
						
							Aid=Cint(ADidss(i))		
							
							if Aids="" then
							Aids=Aid
							else
							Aids=Aids&","&Aid
							end if			
							
							response.write "window.open('"&DqUrl&"/GGtiaoXs.asp?id="&Aid&"','忠网广告"&Aid&"','"&GgtiaoWH(Aid)&",top="&(i*5)&",left="&(i*5)&"');"
							
						next
														
												
							if mid(ADids,len(Aids)+2)<>"" then
							ADids=mid(ADids,len(Aids)+2)&","&Aids
							else
							ADids=Aids
							end if
		
							if ADids1<>"" then ADids=ADids&","&ADids1							
							
							conn.execute "update from Place set ADids='"&ADids&"' where Pid="&Pid	' 入库		
											
						
					 End if
						
					
					end if
					
					end if
		
				
			 End Select
			
			end if
			rs.close '

		
		end if

	END IF
	
	''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	'' 用于XML 当 广告位 显示为 1 类型(循环播放)  判断 广告条是否为 文本 ,如果 是  则直接显示 否则,调用广告条显示页面
	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	Sub xs_1()
		
		strSourceFile1 = Server.MapPath(dataxml&"/Advertisement/"&Aid&"/adv.xml")	 
	    Set objXML1 =Server.CreateObject("Microsoft.XMLDOM")  '创建一个XML对像	   
	    objXML1.load(strSourceFile1)  '把XML文件读入内存     	
		Set xml1=objXML1.documentElement.selectSingleNode("Advertisement")  '选取节点 Advertisement
		ADname=xml1.childNodes.item(1).text
		ADintro=xml1.childNodes.item(2).text
		ADurl=xml1.childNodes.item(7).text
		ADwindow=xml1.childNodes.item(8).text
		ADxslei=xml1.childNodes.item(16).text
		ADcss=xml1.childNodes.item(17).text
		ADipkg=xml1.childNodes.item(19).text	
		
		IF ADxslei="wb" then  ''如果为文本
		xml1.childNodes.item(9).text=xml1.childNodes.item(9).text+1  '' 显示次数加 1	--------------------------------------------	
		objXML1.save(strSourceFile1)		

		
		
		if ADipkg="1" then  '' 如果 ip 开关打开
		Getip=request.ServerVariables("REMOTE_ADDR")		
		Call GgtiaoIp(Aid,Getip,dataxml&"/Advertisement/"&Aid&"/ip1.xml")  '' 新增浏览 ip 记录 -----------------------------------
		end if		
		
		if PubFgdy(ADcss,",",7)="yes" then ADintro="<strong>"&ADintro&"</strong>"
		if PubFgdy(ADcss,",",8)="yes" then ADintro="<em>"&ADintro&"</em>"
		if PubFgdy(ADcss,",",9)="yes" then ADintro="<u>"&ADintro&"</u>"
		
		ADintro="<font size=\"""&PubFgdy(ADcss,",",5)&"\"" face=\"""&PubFgdy(ADcss,",",4)&"\"" color=\"""&PubFgdy(ADcss,",",6)&"\"">"&ADintro&"</font>"
	
		response.write "document.write('<DIV id=\""ZonGGLayer_P_"&Pid&"\"" "&styles&"><a  title=\"""&ADname&"\""  href=\""url.asp?id="&ADid&"&url="&ADurl&"\"" target=\"""&ADwindow&"\"" >"&ADintro&"</a></DIV>');"
		
		ELSE  '' 否则 
		
		gao1=PubFgdy(ADcss,",",0)
		kuan1=PubFgdy(ADcss,",",1)
	
		if PubFgdy(ADcss,",",1)="" then kuan1="100%"
		if PubFgdy(ADcss,",",0)="" then gao1="100%"
	
		stylesa=" style=\""height: "&gao1&"; width: "&kuan1&";border: "&PubFgdy(ADcss,",",2)&"px solid "&PubFgdy(ADcss,",",3)&";\""  "	

		response.write "document.write('<DIV id=\""ZonGGLayer_P_"&Pid&"\"" "&styles&"><iframe marginwidth=0 marginheight=0 "&stylesa&" frameborder=0  scrolling=no  name=\""忠网广告系统--http://gg.zon.cn\"" src=\"""&DqUrl&"/GGtiaoXs.asp?id="&Aid&"\""></iframe></DIV>');"
		
		END IF
		Set xml1=nothing
		Set objXML1 =nothing
		
	End Sub
	
	
	''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	'' 用于数据库 存取 ,当 广告位 显示为 1 类型(循环播放)  判断 广告条是否为 文本 ,如果 是  则直接显示 否则,调用广告条显示页面
	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	Sub xs_2()

		Rs1.open "select * from Advertisement where ADid="&Aid,conn,3,3,1
		if not Rs1.eof then			

			ADname=Rs1(1)
			ADintro=Rs1(2)
			ADurl=Rs1(7)
			ADwindow=Rs1(8)
			ADxslei=Rs1(16)
			ADcss=Rs1(17)
			ADipkg=Rs1(19)			
		
			IF ADxslei="wb" then  ''如果为文本
			Rs1(9)=Rs1(9)+1
			Rs1.update
	
		Rs1.close
			
			
			if ADipkg="1" then  '' 如果 ip 开关打开
			Getip=request.ServerVariables("REMOTE_ADDR")		
			Rs1.open "select * from IP1 where ADid="&Aid,conn,3,3,1
			Rs1.addnew
			Rs1(1)=Aid		
			Rs1(2)=now()
			Rs1(3)=Getip
			Rs1.update
			Rs1.close			
			end if		
			
			if PubFgdy(ADcss,",",7)="yes" then ADintro="<strong>"&ADintro&"</strong>"
			if PubFgdy(ADcss,",",8)="yes" then ADintro="<em>"&ADintro&"</em>"
			if PubFgdy(ADcss,",",9)="yes" then ADintro="<u>"&ADintro&"</u>"
			
			ADintro="<font size=\"""&PubFgdy(ADcss,",",5)&"\"" face=\"""&PubFgdy(ADcss,",",4)&"\"" color=\"""&PubFgdy(ADcss,",",6)&"\"">"&ADintro&"</font>"
		
			response.write "document.write('<DIV id=\""ZonGGLayer_P_"&Pid&"\"" "&styles&"><a  title=\"""&ADname&"\""  href=\""url.asp?id="&ADid&"&url="&ADurl&"\"" target=\"""&ADwindow&"\"" >"&ADintro&"</a></DIV>');"
			
			ELSE  '' 否则 
			
			gao1=PubFgdy(ADcss,",",0)
			kuan1=PubFgdy(ADcss,",",1)
		
			if PubFgdy(ADcss,",",1)="" then kuan1="100%"
			if PubFgdy(ADcss,",",0)="" then gao1="100%"
		
			stylesa=" style=\""height: "&gao1&"; width: "&kuan1&";border: "&PubFgdy(ADcss,",",2)&"px solid "&PubFgdy(ADcss,",",3)&";\""  "	
	
			response.write "document.write('<DIV id=\""ZonGGLayer_P_"&Pid&"\"" "&styles&"><iframe marginwidth=0 marginheight=0 "&stylesa&" frameborder=0  scrolling=no  name=\""忠网广告系统--http://gg.zon.cn\"" src=\"""&DqUrl&"/GGtiaoXs.asp?id="&Aid&"\""></iframe></DIV>');"
			
			END IF
	 
 		end if
	End Sub
	
	call close_conn()
	
	%>